package com.ihisun.tmhcms.core.service.withdrawalsettingsservice.Impl;

import com.ihisun.tmhcms.core.dao.withdrawalsettingsdao.EditWithdrawalSettingsDao;
import com.ihisun.tmhcms.core.dao.withdrawalsettingsdao.WithdrawalSettingsDao;
import com.ihisun.tmhcms.core.dto.withdrawalsettingsdto.EditWithdrawalSettingsDto;
import com.ihisun.tmhcms.core.service.withdrawalsettingsservice.WithdrawalSettingsService;
import com.ihisun.tmhcms.core.vo.WithdrawalSettingsVo;
import com.ihisun.tmhcms.utils.DateUtils;
import com.ihisun.tmhcms.utils.ResponseVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class WithdrawalSettingsServiceImpl implements WithdrawalSettingsService {
    @Resource
    WithdrawalSettingsDao withdrawalSettingsDao;
    @Resource
    EditWithdrawalSettingsDao editWithdrawalSettingsDao;

    @Override
    public ResponseVo echoWithdrawalSize() {
        List<WithdrawalSettingsVo> all = withdrawalSettingsDao.findAll();
        return ResponseVo.ok(all);
    }

    @Override
    public ResponseVo editWithdrawalSize(EditWithdrawalSettingsDto editWithdrawalSettingsDto) {
        editWithdrawalSettingsDto.setUpdateTime(DateUtils.getCurrentTime());
        editWithdrawalSettingsDao.save(editWithdrawalSettingsDto);
        return ResponseVo.ok();
    }
}
